from django.db import models
import datetime
from django.utils.timezone import utc
# Create your models here.
class Monitor(models.Model):
    #id是django默认帮你创建，然后默认是主键，自增长
    #列名 ,字符串类型，指定字符串的长度为32
    instanceName = models.CharField(max_length=32)
    metricName = models.CharField(max_length=32)
    curValue = models.CharField(max_length=32)
    triggerLevel= models.CharField(max_length=32)
    dimensions= models.CharField(max_length=64)
    timestamp = models.DateTimeField('告警日期',default =datetime.datetime.now().replace(tzinfo=utc))
    def __str__(self):
        return self.instanceName


class Logerror(models.Model):
    type = models.CharField(max_length=64) #告警类型
    project=models.CharField(max_length=32) #内容
    value=models.CharField(max_length=1024) #内容
    timestamp = models.DateTimeField('告警日期', default=datetime.datetime.now().replace(tzinfo=utc))